<?php

/**
 * campana form base class.
 *
 * @method campana getObject() Returns the current form's model object
 *
 * @package    plagas
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasecampanaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'lote_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('lote'), 'add_empty' => false)),
      'variedad_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('variedad'), 'add_empty' => false)),
      'sistemasiembra_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sistemasiembra'), 'add_empty' => false)),
      'fecha_siembra'       => new sfWidgetFormDateTime(),
      'distanciasiembra_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('distanciasiembra'), 'add_empty' => false)),
      'obs'                 => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'lote_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('lote'))),
      'variedad_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('variedad'))),
      'sistemasiembra_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('sistemasiembra'))),
      'fecha_siembra'       => new sfValidatorDateTime(),
      'distanciasiembra_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('distanciasiembra'))),
      'obs'                 => new sfValidatorString(array('max_length' => 200, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('campana[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'campana';
  }

}
